﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

using IronOne.SalesOne.BusinessObjects;
using IronOne.SalesOne.DataObjects;

namespace Facade
{
    public class FinanceFacade
    {
        #region Income

        LinqIncome linqIncome = new LinqIncome();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Income GetIncomeForCustomer(string customerId)
        {
            return linqIncome.GetIncomeForCustomer(customerId);
        }

        #endregion

        #region Liability

        LinqLiabilities linqLia = new LinqLiabilities();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Liability GetLiabilitiesForCustomer(string customerId)
        {
            return linqLia.GetLiabilitiesForCustomer(customerId);
        }

        #endregion

        #region Expenses

        LinqExpenses linqExp = new LinqExpenses();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Expense GetExpensesForCustomer(string customerId)
        {
            return linqExp.GetExpensesForCustomer(customerId);
        }

        #endregion

        #region Assets

        LinqAsset linqAss = new LinqAsset();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public Asset GetAssetsForCustomer(string customerId)
        {
            return linqAss.GetAssetForCustomer(customerId);
        }

        #endregion

        #region Collection

        LinqCollectionTransaction collTransactions = new LinqCollectionTransaction();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<CollectionTransaction> GetCollectionTransactions(string cssNo,string cssStatus,int branchId,string unitCode,string SOCode,string sortExpression,int pageNo)
        {
            return collTransactions.GetCollectionTransaction(cssNo, cssStatus, branchId, unitCode, SOCode, sortExpression, pageNo);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<CollectionTransaction> GetCollectionByBranch(int branchId, DateTime fromDate, DateTime toDate)   
        {
            return collTransactions.GetCollectionByBranch(branchId, fromDate, toDate);
        }

        /// <summary>
        /// Suren Manawatta
        /// 2012-11-05
        /// Same as the above function, but it facilitates multiple branches
        /// </summary>
        /// <param name="branchIds"></param>
        /// <param name="fromDate"></param>
        /// <param name="toDate"></param>
        /// <returns></returns>
        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<CollectionTransaction> GetCollectionByBranchList(int[] branchIds, DateTime fromDate, DateTime toDate)
        {
            return collTransactions.GetCollectionByBranchList(branchIds, fromDate, toDate);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<CollectionTransaction> GetCSSDetailsByCSSNo(string CSSNo,string payMethod,string SOCode,string status, bool isHQMgr)
        {
            return collTransactions.GetCSSDetailsByCSSNo(CSSNo, payMethod, SOCode,status, isHQMgr);
        }

        //[DataObjectMethod(DataObjectMethodType.Update)]
        //public int UpdateCollection(List<CollectionTransaction> collectionTransactions)
        //{
        //    return collTransactions.UpdateCollection(collectionTransactions);
        //}

        public int VerifyCollection(string SOCOde, long ReceiptNo, string status, string verifiedBy)
        {
            return collTransactions.UpdateCollectionStatus(SOCOde, ReceiptNo, status,verifiedBy);
        }

        public int CancelCollection(string SOCOde, long ReceiptNo, string status,string doneBy)
        {
            return collTransactions.CancelCollectionStatus(SOCOde, ReceiptNo, status,doneBy);
        }



        public int UpdateCollectionGrid(string SOCOde, long receiptNo,
                                        string contr_ClientID,
                                        string loanInt,
                                        string type,
                                        string bankedStatus,
                                        string chqNo,
                                        string bankCD,
                                        string branchCD,
                                        string doneBy)
        {
            return collTransactions.UpdateCollectionGrid(SOCOde, receiptNo, contr_ClientID, loanInt, type, bankedStatus, chqNo, bankCD, branchCD, doneBy);
        }

        public int UpdateCahierRemarks(string SOCOde, long ReceiptNo, string remarks,string doneBy)
        {
            return collTransactions.UpdateCahierRemarks(SOCOde, ReceiptNo, remarks,doneBy);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<CollectionTransaction> GetReceiptDetails(long recNo, string SOCode)
        {
            return collTransactions.GetReceiptDetails(recNo, SOCode);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<CollectionTransaction> GetRemarks(string SOCOde, long ReceiptNo)
        {
            return collTransactions.GetRemarks(SOCOde, ReceiptNo);
        }

        public int UpdateChangeLog(string SOCOde, long ReceiptNo, string newLog, string loggedUser)
        {
            return collTransactions.UpdateChangeLog(SOCOde, ReceiptNo, newLog, loggedUser);
        }

        #endregion

        #region Product

        LinqProduct linqProduct = new LinqProduct();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Product> GetProduct(string planCode)
        {
            return linqProduct.GetProduct(planCode);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Product> GetProducts(Product product, int page)
        {
            return linqProduct.GetProducts(product, page);
        }
        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<Product> GetProductsss(int product)
        {
            return linqProduct.GetProductsss(product);
        }


        public Product GetOneProduct(string productCode)
        {
            return linqProduct.GetOneProduct(productCode);
        }

        
        [DataObjectMethod(DataObjectMethodType.Update)]
        public int UpdateProductTrans(Product product)
        {
            return linqProduct.UpdateProductTrans(product);
        }


        #endregion

        #region Benefit

        LinqLifeBenefit linqLifeBenefit = new LinqLifeBenefit();

        [DataObjectMethod(DataObjectMethodType.Select)]   
        public List<QuoLifeBenefit> GetBenefit(string benefitCode, int page)
        {         
            return linqLifeBenefit.GetBenefit(benefitCode, page);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<QuoLifeBenefit> GetBenefits(string benefitCodes, int page)
        {
            return linqLifeBenefit.GetBenefits(benefitCodes, page);
        }
        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<QuoLifeBenefit> GetBenefitsD(string benefitCodes)
        {
            return linqLifeBenefit.GetBenefitsD(benefitCodes);
        }
       
        [DataObjectMethod(DataObjectMethodType.Select)]
        public QuoLifeBenefit GetOneBenefit(string benefitCode)
        {
            return linqLifeBenefit.GetOneBenefit(benefitCode);
        }

        [DataObjectMethod(DataObjectMethodType.Update)]
        public int UpdateBenefit(QuoLifeBenefit benefit)
        {
            return linqLifeBenefit.UpdateBenefit(benefit);
        }


        #endregion

        #region ProductCategory

        LinqProductCategory linqProductCategory = new LinqProductCategory();

        [DataObjectMethod(DataObjectMethodType.Select)]
        public ProductCategory GetProductCategory(int productCategoryCode)
        {

            return linqProductCategory.GetProductCategory(productCategoryCode);
        }

        [DataObjectMethod(DataObjectMethodType.Select)]
        public List<ProductCategory> GetProductCategories(String productCategory)
        {
            return linqProductCategory.GetProductCategories(productCategory);
        }

        # endregion

    
    }
}
